//遍历数组求和
//夏梓豪
//2023/03/31

package code_bianliqiuhe;

import java.util.Random;

public class test1 {
    public static void main(String[] args) {
    int[] arr = new int[10];
    int sum = 0;
    int counter = 0;
    Random r = new Random();
        for (int i = 0; i < arr.length; i++) {
            arr[i] = r.nextInt(100)+1;
            sum += arr[i];

        }
        double avg = sum/ arr.length;

        for (int j = 0; j < arr.length; j++) {
            if (arr[j]<avg){
                counter++;
            }
        }

        System.out.println("随机数组的遍历总和为："+sum);
        System.out.println("随机数组的遍历总和平均数为："+avg);
        System.out.println("随机数组中的遍历数组中比平均值小的有"+counter+"个");
    }
}
